package com.itggm.controller;

import com.itggm.pojo.Emp;
import com.itggm.pojo.Result;
import com.itggm.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class LonginController {
    @Autowired
    private EmpService empService;
   @PostMapping("/login")
    public Result login(@RequestBody Emp emp){
       log.info("用户登录");
       Emp e = empService.login(emp);
       return  e != null ? Result.success():Result.error("用户名或密码错误");
    }

}
